home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cgraphix / chatch.c < prev    next >
Text File  |  1986-05-28  |  794b  |  45 lines

  1. /* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
  2. #include    <stdio.h>
  3. #define    EXTERN    extern
  4. #include    <typedef.h>
  5.  
  6.  
  7. main()
  8. {
  9.     int        i;
  10.     double    x1,x2,y1,y2,temp;
  11.  
  12.     InitGraphic();
  13.  
  14.     DefineWorld(1, 0., 0., 1000., 1000.);
  15.     SelectWorld(1);
  16.     SelectWindow(1);
  17.     DrawBorder();
  18.  
  19.     for (i = 1; i <= 10; i++) {
  20.         x1 = 50. + 800. * i / 10.;
  21.         x2 = 150. + 800. * i / 10.;
  22.         y1 = 50. + 800. * i / 10.;
  23.         y2 = 150. + 800. * i / 10.;
  24.  
  25.         if (x1 > x2) {
  26.             temp = x1;
  27.             x1 = x2;
  28.             x2 = temp;
  29.         }
  30.  
  31.         if (y1>y2) {
  32.             temp = y1;
  33.             y1 = y2;
  34.             y2 = temp;
  35.         }
  36.  
  37.         DrawSquare((double)x1, (double)y1, (double)x2, (double)y2, FALSE);
  38.         Hatch((double)x1, (double)y1, (double)x2, (double)y2, (double)2. * i);
  39.     }
  40.  
  41.     inkey();
  42.     LeaveGraphic();
  43. }
  44.  
  45.